package cn.enaium.message.specific;

import cn.enaium.message.config.JdbcConfig;
import cn.enaium.message.entity.Muser;
import cn.enaium.message.repository.MuserRepository;
import org.apache.ibatis.session.SqlSession;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SelectUser {
    @GetMapping(value = "/selectuser")
    public Muser SelUser(String id){
        JdbcConfig jdbcConfig = new JdbcConfig();
        SqlSession sqlSession= jdbcConfig.getSqlSession();
        //获取用户密码接口的代理对象
        MuserRepository muserRepository=sqlSession.getMapper(cn.enaium.message.repository.MuserRepository.class);
        Muser muser = muserRepository.findByIdMuser(Long.parseLong(id));
        //关闭Sql链接
        jdbcConfig.sqlSessionClose();
        sqlSession.close();
        return muser;
    }
}
